package com.shimao.celnet.payment.service.impl.report;

import com.shimao.celnet.payment.form.PPayDayReportForm;
import com.shimao.celnet.payment.mapper.PPayDaySumMapper;
import com.shimao.celnet.payment.mapper.PPayDetailMapper;
import com.shimao.celnet.payment.mapper.PPayRefundMapper;
import com.shimao.celnet.payment.model.PPay;
import com.shimao.celnet.payment.service.impl.BaseServiceImpl;
import com.shimao.celnet.payment.service.report.PPayDayReportService;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;


/**
 * 支付申请信息 管理
 * Created by ensure on 2017/12/3.
 */
@Service
public class PPayDayReportServiceImpl extends BaseServiceImpl<PPay> implements PPayDayReportService {
    protected Logger logger = Logger.getLogger(this.getClass());

    @Autowired(required = false)
    private PPayDaySumMapper pPayDaySumMapper;

    @Autowired(required = false)
    private PPayDetailMapper pPayDetailMapper;

    @Autowired(required = false)
    private PPayRefundMapper pPayRefundMapper;

    /**
     * 1、支付日报
     * 2、支付记录-详情查询
     * @param formBean
     * @return
     */
    @Override
    public PPayDayReportForm getReportExcel(PPayDayReportForm formBean) {
        logger.info("开始");
        //查询条件
        Map<String,String> pMap = new HashMap<String,String>();
        pMap.put("estateSfGuid",formBean.getEstateSfGuid());
        pMap.put("payDate",formBean.getPayDate());

        //日报汇总
        formBean.setExcelDayTotalList(pPayDaySumMapper.selectReport(pMap));

        //日报支付明细
        formBean.setExcelPayDetailList(pPayDetailMapper.selectReport(pMap));

        //日报退款明细
        formBean.setExcelRefundPayList(pPayRefundMapper.selectReport(pMap));

        return  formBean;
    }

}
